/*
Static rab route 
author          : guofeng
create date   : 2019-01-09
*/

#ifndef _STATIC_RAB_ROUTE_H
#define _STATIC_RAB_ROUTE_H

typedef unsigned int u32;
typedef unsigned short u16;
typedef unsigned char u8;
#define MAX_BUF 1024
#define MAX_SW_ENTRY_NUM 20
#define RIO_SW_SEL_INPORT_REG    0x10070
#define RIO_SW_SEL_DST_REG       0x70
#define RIO_SW_SEL_OUTPORT_REG   0x74
#define HR2_RAB_ID_REG           0x60
#define ID_START_PRE 2
#define ID_LEN 5
#define PORT_START_PRE 0
#define SW_INFO_LEN_MAX 20
#define INVAILD_PORT_NO 0xffff
#define ADD_RTE  1
#define DEL_RTE  2
#define MAX_SWITCH_PORT 12
#define GLOBA_RIO_ID_MAX 256

typedef struct{
	u32 src_port;
	u32 dst_port;
	u32 sw_id;
	u32 valid_flag;
} sw_entry;

typedef struct {
	u32 src_id;
	u32 dst_id;
	sw_entry switch_entry[MAX_SW_ENTRY_NUM];
	u32 sw_index;
} route_entry;

typedef struct{
	u32 host_sw_id;
	u32 sw_inport;
	sw_entry switch_entry[MAX_SW_ENTRY_NUM];
	u32 sw_index;
} host_sw_rte;

#define RIO_16BIT_ID 0xffff
#define FILE_NAME_LEN  256

#define SET_SRC_ID 0
#define SET_DST_ID 1
#define SW4_TO_SW5_PORT0 0
#define SW_RAB0_TO_SW1  9
#define SLOT1_SWID  0x5
#define SLOT2_SWID  0x6
#define SW_HOPCNT_INBOARD 1
#define SW_HOPCNT_OUTBOARD 2
#define SW_CHIP1 1
#define SW_CHIP2 2
#define SW_CHIP3 3
#define SW_CHIP4 4

#define route_log log_msg

void set_route_init(void);
int set_static_route(char *filepath);


#endif
